﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NeatUpload.aspx.vb" Inherits="NeatUpload" EnableEventValidation="false" %>

<%@ Register TagPrefix="Upload" Namespace="Brettle.Web.NeatUpload" Assembly="Brettle.Web.NeatUpload" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script>
        function DoConfirm(msg)
        {
            var x = confirm(msg);
            document.forms[0].<%=ConfirmBox.ClientID%>.value = x;
        }

        function F05_close(filecount,rownum){
            parent.setAttach(filecount,rownum);
        }
    </script>

    <link href="css/style.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server"></asp:ScriptManager>
        <br />
        <fieldset id="fieldset2" runat="server" style="width: 500px; margin-left: 15px;">
            <legend class="text" style="text-align: left">:::. แนบไฟล์&nbsp;</legend>
            <asp:HiddenField ID="hddCmmtCode" runat="server" />
            <asp:HiddenField ID="hddActivityTypeCode" runat="server" />
            <asp:HiddenField ID="hddPlanYear" runat="server" />

            <br />
            <center>
                <table>
                    <tr>
                        <td align="right">
                            <asp:Label ID="Label1" runat="server" Width="54px">ชื่อเอกสาร</asp:Label>
                            <asp:Label ID="Label2" runat="server" Text="*" ForeColor="red"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:TextBox runat="server" ID="Title" Width="212px"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td  align="right">
                            <asp:Label ID="Label12" runat="server" Width="87px" Height="16px" Style="margin-left: 0px">ไฟล์ที่จะแนบ</asp:Label>
                            <asp:Label ID="Label36" runat="server" Text="*" ForeColor="red"></asp:Label></td>
                        <td align="left">
                            <Upload:InputFile ID="DocumentFile" runat="server"></Upload:InputFile>
                        </td>
                    </tr>
                </table>
                <br />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="DocumentFile"
                ErrorMessage="ต้องการเอกสารแนบ (Attachment)" ValidationGroup="2" SetFocusOnError="True" Display="None"
                Font-Size="11px" Font-Bold="True"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Title"
                ErrorMessage="กรุณาระบุชื่อเอกสาร" ValidationGroup="2" SetFocusOnError="True" Display="None"
                Font-Size="11px" Font-Bold="True" ></asp:RequiredFieldValidator>
                <asp:ValidationSummary DisplayMode="BulletList" ID="valid_sum" runat="server" ValidationGroup="2" />
                 <asp:Label ID="filelimit" runat="server" Text="ไม่สามารถแนบไฟล์เอกสารที่มีขนาดเกิน 2 MB ได้" ForeColor="Red"  Font-Bold="true" Visible="false"></asp:Label>
                <br />
                               
                <br />
                <asp:Button ID="SaveDocument" runat="server" Text="บันทึก" ValidationGroup="2" CssClass="button3" />
            </center>





            <script type="text/javascript">
                window.onload = function () {
                    var inlineProgressBar = NeatUploadPB.prototype.Bars["<%=inlineProgressBar.ClientID%>"];
                    var origDisplay = inlineProgressBar.Display;
                    inlineProgressBar.Display = function () {
                        var elem = document.getElementById(this.ClientID);
                        elem.parentNode.style.display = "block";
                        origDisplay.call(this);
                    }
                    inlineProgressBar.EvalOnClose = "NeatUploadMainWindow.document.getElementById('"
        + inlineProgressBar.ClientID + "').parentNode.style.display = \"none\";";

                }
            </script>





            <br />

            <div style="display: none;">
                &nbsp;
                                <Upload:ProgressBar ID="inlineProgressBar" runat="server" Inline="true" Triggers="SaveDocument"
                                    CssClass="Progress" Width="400px" Height="25px" ForeColor="Red">
                                </Upload:ProgressBar>
            </div>
        </fieldset>
        <br />
        <br />
        &nbsp;<fieldset id="fieldset3" runat="server" style="width: 500px; margin-left: 15px;">
            <legend class="text" style="text-align: left">:::. ไฟล์ที่แนบ&nbsp;</legend>

            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                CellPadding="1" ForeColor="#333333" Width="500px">
                <Columns>
                    <asp:TemplateField HeaderText="ลำดับ">
                        <ItemTemplate>
                            <asp:Label ID="RunningNo" runat="server" Text="Label" Width="40px"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Font-Bold="False" ForeColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ประเภทไฟล์">
                        <ItemTemplate>
                            <asp:Label ID="DocumentTypeName" runat="server" Text='<%# Bind("fileType")%>'
                                Width="120px" BackColor="Transparent"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Left" />
                        <HeaderStyle HorizontalAlign="Center" Font-Bold="False" ForeColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ชื่อเอกสาร">
                        <ItemTemplate>
                            <asp:Label ID="FullName" runat="server" Text='<%# Bind("Title")%>' Width="150px"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Left" />
                        <HeaderStyle Font-Bold="False" ForeColor="White" />
                    </asp:TemplateField>
                    <%--<asp:TemplateField HeaderText="ชื่อไฟล์แนบ">
                        <ItemTemplate>
                            <asp:Label ID="FileName1" runat="server" Text='<%# Eval("Title") + Eval("fileType")%>' Width="150px"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Left" />
                        <HeaderStyle Font-Bold="False" ForeColor="White" />
                    </asp:TemplateField>--%>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="ProjectDocumentID" runat="server" Text='<%# Bind("ID") %>'
                                Visible="False"></asp:Label>
                            <asp:Label ID="Filename" runat="server" Text='<%# Bind("filename") %>'
                                Visible="False"></asp:Label>
                            <img src="Images/Icons/view.png" onclick="<%# GenerateOnClick(Eval("filename"), (Eval("Title") + Eval("fileType")))%>" style="cursor: pointer" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Font-Bold="False" Height="15px" ForeColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:ImageButton
                                ID="DeleteDocument" runat="server" BorderWidth="1px" ImageUrl="Images/Icons/delete.png" BorderStyle="None"
                                OnClientClick="DoConfirm('ยืนยันการลบข้อมูล?')" OnClick="DeleteDocument_Click" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Font-Bold="False" Height="15px" ForeColor="White" />
                    </asp:TemplateField>
                </Columns>
                <RowStyle BackColor="#EFF3FB" />
                <EditRowStyle BackColor="Gainsboro" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" Font-Bold="True"
                    Font-Underline="True" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Font-Underline="False" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" />
                <PagerSettings Mode="NumericFirstLast" />
            </asp:GridView>

            <asp:HiddenField ID="ConfirmBox" runat="server" />
        </fieldset>
    </form>
    <%=scripttext %>
</body>
</html>
